#pragma once
#include <vector>

template <class T>
class grid {
    std::vector<T> data;
    public:
    const int w;
    const int h;
    grid(int _w, int _h) : data(_w * _h), w(_w), h(_h) { }
    T& operator()(int x, int y) { return data[y*w+x]; }
    const T& operator()(int x, int y) const { return data[y*w+x]; }
};
